home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 3 / Amiga Format CD03 (1996-07-04)(Future Publishing)(GB)(Track 1 of 6)[!][issue 1996-08].iso / comms / netsoftware / amitcp2_x_gcc.lha / sana2printfault.c < prev    next >
C/C++ Source or Header  |  1994-01-12  |  1KB  |  56 lines

  1. char RCS_ID_SANA2PRINTFAULT_C[] = "$Id: sana2printfault.c,v 1.3 1994/01/12 18:39:33 jasegler Exp jasegler $";
  2. /*
  3.  * sana2printfault.c --- print SANA-II error message
  4.  *
  5.  * Author: ppessi <Pekka.Pessi@hut.fi>
  6.  *
  7.  * Copyright © 1993 AmiTCP/IP Group, <amitcp-group@hut.fi>
  8.  *                  Helsinki University of Technology, Finland.
  9.  *                  All rights reserved.
  10.  *
  11.  * Created      : Sat Mar 20 02:10:14 1993 ppessi
  12.  * Last modified: Fri Jun  4 02:20:34 1993 ppessi
  13.  */
  14.  
  15. #include <devices/sana2.h>
  16. #include <net/sana2errno.h>
  17. #ifdef __SASC
  18. #include <proto/dos.h>
  19. #else
  20. #include <clib/dos_protos.h>
  21. #endif
  22.  
  23. void
  24. Sana2PrintFault (const char *banner, struct IOSana2Req *ios2)
  25. {
  26.   register WORD err = ios2->ios2_Req.io_Error;
  27.   register ULONG werr = ios2->ios2_WireError;
  28.   LONG args[3];
  29.   char *format;
  30.  
  31.   args[0] = (LONG) banner;
  32.  
  33.   if (err >= sana2io_nerr || -err > io_nerr)
  34.     {
  35.       args[1] = (LONG) io_errlist[0];
  36.     }
  37.   else
  38.     {
  39.       if (err < 0)
  40.     args[1] = (LONG) io_errlist[-err];
  41.       else
  42.     args[1] = (LONG) sana2io_errlist[err];
  43.     }
  44.   if (werr == 0 || werr >= sana2wire_nerr)
  45.     {
  46.       format = "%s: %s\n";
  47.     }
  48.   else
  49.     {
  50.       format = "%s: %s (%s)\n";
  51.       args[2] = (LONG) sana2wire_errlist[werr];
  52.     }
  53.  
  54.   VPrintf (format, args);
  55. }
  56.